import React from 'react';
import { getToken } from '@/utils/cookies';
import Redirect from 'umi/redirect';
import { Breadcrumbs } from 'scd';

export default ({ children, route, location }) => {
  if (getToken()) {
    return (
      <>
        <Breadcrumbs route={route} location={location} />
        {children}
      </>
    );
  }
  return <Redirect to="/login" />;
};
